const mongoose = require('mongoose');
const { Schema, model } = mongoose;

const userSchema = new Schema({
  username: { type: String, default: 'user' },
  email: { type: String },
  password: { type: String, require: true, select: false }, // todo select 还是显示的问题
  __v: { type: Number, select: false },
  avatar: { type: String },
  gender: { type: String, enum: ['male', 'female'], default: 'male' },
  headline: { type: String, default: '' }, // 简介
  age: { type: Number, default: 0 },
  following: { type: [{ type: Schema.Types.ObjectId, ref: 'User' }], select: false }, // 引用
  followingTopics: { type: [{ type: Schema.Types.ObjectId, ref: 'Topic' }], select: false }, // 引用
  likeHandAccounts: { type: [{ type: Schema.Types.ObjectId, ref: 'HandAccount'}], select: false }
});

module.exports = model('User', userSchema)